# Originally from config for buildbot.
# See third_party/buildbot_8_4p1/COPYING

{% macro change(c) %}

<table class="info">
  {% set row_class=cycler('alt','') %}
  <tr class="{{ row_class.next() }}">
    <td class="left">Changed by</td>
    <td><b>{{ c.who|email }}</b></td>
  </tr>
  <tr class="{{ row_class.next() }}">
    <td class="left">Changed at</td>
    <td><b>{{ c.at }}</b></td>
  </tr>

  {% if c.repository %}
  <tr class="{{ row_class.next() }}">
    <td class="left">Repository</td>
    <td><b>{{ c.repository|repolink }}</b></td>
  </tr>
  {% endif %} {% if c.project %}
  <tr class="{{ row_class.next() }}">
    <td class="left">Project</td>
    <td><b>{{ c.project|projectlink }}</b></td>
  </tr>
  {% endif %} {% if c.branch %}
  <tr class="{{ row_class.next() }}">
    <td class="left">Branch</td>
    <td><b>{{ c.branch|e }}</b></td>
  </tr>
  {% endif %} {% if c.rev %}
  <tr class="{{ row_class.next() }}">
    <td class="left">Revision</td>
    <td>{%- if c.revlink -%}<a href="{{ c.revlink }}">{{ c.rev|e }}</a>
    {%- else -%}{{ c.rev|revlink(c.repository) }} {%- endif -%}</td>
  </tr>
  {% endif %}
</table>

{% if c.comments %}
<h3>Comments</h3>
<pre class="comments">{{ c.comments|changecomment(c.project) }}</pre>
{% endif %}

<h3 class="files">Changed files</h3>
<ul>
  {% for f in c.files -%}
  <li class="{{ loop.cycle('alt', '') }}">{%- if f.url %}<a
    href="{{ f.url }}"><b>{{ f.name|e }}</b></a></li>
  {%- else %}
  <b>{{ f.name|e }}</b>
  {%- endif -%}
  </li>
  {% else %}
  <li>no files</li>
  {% endfor %}
</ul>

{% if c.properties %}
<h3>Properties</h3>
<table class="info">
  {% for p in c.properties %}
  <tr class="{{ loop.cycle('alt') }}">
    <td class="left">{{ p[0]|capitalize|e }}</td>
    <td>{{ p[1]|e }}</td>
  </tr>
  {% endfor %}
</table>
{% endif %} 
{%- endmacro %} 

{% macro box_contents(who, url, pageTitle, revision, project) -%}
<a href="{{ url }}" title="{{ pageTitle|e }}">{{ who|user }}</a><br>{{ project }} r{{ revision }}
{%- endmacro %}
